<%--
$Id: messageBoard-list.jsp 13 2010-11-02 15:35:59Z feigme $
--%>
<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@ include file="/WEB-INF/content/commons/taglibs.jsp" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<fmt:setBundle basename="i18n/globalMessages"/>
<head>
<title><fmt:message key="common.message.board"/></title>
</head>
<body>
<div>
	<form action="/message-board/new" method="post">
		<textarea rows="4" cols="60" name="content"></textarea><br/>
		<sec:authorize access="isAuthenticated()">
		<sec:authentication property="principal" var="authentication"/>
		<input name="author" value="${authentication.username }" readonly="readonly"/><br/>
		</sec:authorize>
		<sec:authorize access="isAnonymous()">
		<input name="author" value=""/><br/>
		</sec:authorize>
		<button type="submit"><fmt:message key="common.submit"/></button>
	</form>
</div>
<div id="msgBoard">
	<c:forEach items="${msgPage.result}" var="msg">
	<div class="clearfix">
  		<div class="logo"><c:out value="${msg.author}"/></div>
  		<div class="content">
  			<c:out value="${msg.content}"/>
  		</div>
	</div>
	</c:forEach>
</div>
<div style="clear:both; float:right;padding:5px;">
<table>
<tr>
   	<td>
   		<c:if test="${msgPage.hasPre}"><a href="${ctx }/message-board/list/<c:out value="${msgPage.prePage}"/>"><fmt:message key="common.prev"/></a></c:if>
   		<c:if test="${msgPage.totalPages>1}" >
   		<c:forEach begin="1" var="page" end="${msgPage.totalPages}">
   			&nbsp;
   			<c:choose>
				<c:when test="${msgPage.pageNo!=page}">
					<a href="${ctx }/message-board/list/<c:out value="${page}" />">
						<c:out value="${page}" />
					</a>	
				</c:when>
				<c:otherwise>
					<c:out value="${page}" />
				</c:otherwise>
			</c:choose>
   		</c:forEach>
   		</c:if>
   		<c:if test="${msgPage.hasNext}">&nbsp;<a href="${ctx }/message-board/list/<c:out value="${msgPage.nextPage}" />"><fmt:message key="common.next"/></a></c:if>
   	</td>
    </tr>
</table>   
</div>
</body>
</html>